/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Merlion.MRP.bean;

import Merlion.util.state.ATPCheckState;
import Merlion.util.state.PlannedDemandState;
import Merlion.util.state.SalesOperationPlanState;
import Merlion.util.state.SalesRecordState;
import java.util.Date;
import java.util.List;
import javax.ejb.Remote;

/**
 *
 * @author Indra
 */
@Remote
public interface DemandManagementBeanRemote {

    /*
     * D.1.1 - D.1.6 Monthly Sales Records Operations
     */
    boolean createMonthlySalesRecord(Long productId, Integer yearInt, Integer monthInt, int actualBase, int actualPromotion, int actualSales); //fixed

    boolean deleteMonthlySalesRecord(Long productId, Integer yearInt, Integer monthInt); // fixed

   
    List<SalesRecordState> viewMonthlySalesRecords(String constraint); //fixed

    SalesRecordState aggregateAnnualSales(Integer yearInt); //fixed

    SalesRecordState aggregateAnnualForecast(Integer yearInt); //fixed

    /*
     * D.1.7 - D.1.17 Planned Demand Operations
     */
    // Planned Monthly Demand
    boolean createMonthlyPlannedDemand(Long productId, Integer yearInt, Integer monthInt, int demand);

    boolean convertMonthlyProjectedSalesToPlannedDemand(Long productID, Integer yearInt, Integer monthInt); //fixed

    boolean updateMonthlyPlannedDemand(Long productId, Integer yearInt, Integer monthInt, int demand);

    boolean deleteMonthlyPlannedDemand(Long productId, Integer yearInt, Integer monthInt);

    // Planned Weekly Demand
    List<PlannedDemandState> generateWeeklyPlannedDemands(Long productId, Integer yearInt, Integer monthInt);

    boolean createWeeklyPlannedDemand(Long productId, Integer yearInt, Integer monthInt, Integer weekOfMonth, int demand);

    boolean updateWeeklyPlannedDemand(Long productId, Integer yearInt, Integer monthInt, Integer weekOfMonth, int demand);

    boolean deleteWeeklyPlannedDemand(Long productId, Integer yearInt, Integer monthInt, Integer weekofMonth);

    // Planned Daily Demand
    List<PlannedDemandState> generateDailyPlannedDemands(Long productId, Integer yearInt, Integer monthInt, Integer weekOfMonth);

    boolean createDailyPlannedDemand(Long productId, Integer yearInt, Integer monthInt, Integer weekOfMonth, Integer dayOfMonth, int demand);

    boolean updateDailyPlannedDemand(Long productId, Integer yearInt, Integer monthInt, Integer weekOfMonth, Integer dayOfMonth, int demand);

    boolean deleteDailyPlannedDemand(Long productId, Integer yearInt, Integer monthInt, Integer weekOfMonth, Integer dayOfMonth);

    // Views
    List<PlannedDemandState> viewPlannedDemands(int option);

    /*
     * D.1.18 - D.1.21 Unplanned Demand Operations
     */
    public boolean createUnplannedDailyDemand(Merlion.MRP.entity.BackOrderEntity bo, Merlion.MRP.entity.PlannedDailyDemandEntity pdd, int demand);

    //public boolean createUnplannedDailyDemand(PlannedDailyDemandEntity pdd, int demand);

    public boolean deleteUnplannedDailyDemand(Long id);

    public void updateUnplannedDailyDemand(Long id, int quantity);
    
    public void commitUnplannedDailyDemand(Long id);
    /*
     * D.1.22 - D.1.23 Lead Time Operations
     */
    //boolean forecastAnnualSales(Integer yearInt, double growthRate, int projectedPromotion);

    public boolean forecastMonthlySales(Long productId, Integer yearInt, Integer monthInt, double growthRate, int projectedPromotion); //fixed

    //boolean setProjectionCompositionPerProduct(MonthlySalesRecordEntity monthlySalesRecord, ProductEntity product, double percentage);

   //public ATPCheckState calculateLeadTime(Long salesDocId, Long productId, int demand, Date checkingDate, int bufferDays, boolean reserve);

    /*
    public PlannedMonthlyDemandEntity getPlannedMonthlyDemand(Long productId, Integer yearInt, Integer monthInt);

    public PlannedDailyDemandEntity getPlannedDailyDemand(Long productId, Integer yearInt, Integer monthInt, Integer weekOfMonth, Integer dayOfMonth);

    public PlannedWeeklyDemandEntity getPlannedWeeklyDemand(Long productId, Integer yearInt, Integer monthInt, Integer weekOfMonth);
     */
    public ATPCheckState calculateLeadTime(Long salesDocId, Long productId, int demand, Date checkingDate, int bufferDays, int indicativeLeadTime, int option);

    public List<Merlion.util.state.SalesRecordState> viewMonthlySalesRecordsByProduct(Long id);

    public void deleteMonthlySalesRecord(String recordId);

    public boolean updateMonthlySalesRecord(Long productId, Integer yearInt, Integer monthInt, int actualBase, int actualPromotion, int actualSales, boolean status);

    public void updateSalesCompositionRatios();

    public SalesRecordState updateSingleMonthlyForecast(Integer yearInt, Integer monthInt, double growthRate, int projectedPromotion);

    public List<Merlion.util.state.SalesRecordState> forecastSales(Integer fromYear, Integer fromMonth, Integer toYear, Integer toMonth, int growthRate);

    public SalesOperationPlanState updateSingleMonthlySalesOperationPlan(Integer yearInt, Integer monthInt, int productionPlanInput);

    public boolean commitMonthDailyPlannedDemand(Integer yearInt, Integer monthInt);

    public void finalizeSingleMonthlyForecast(Integer yearInt, Integer monthInt);

    public java.util.List<Merlion.util.state.SalesOperationPlanState> generateSalesOperationPlanByPeriod(int period, java.lang.Integer yearInt, java.util.List<java.lang.Object[]> idRatioMap);

    public void deFinalizeSingleMonthlyForecast(java.lang.Integer yearInt, java.lang.Integer monthInt);

    public java.util.List<Merlion.util.state.SalesOperationPlanState> finalizeSalesOperationPlanByPeriod(int period, java.lang.Integer yearInt, java.util.List<java.lang.Object[]> idRatioMap);

    public java.util.List<Merlion.util.state.SalesOperationPlanState> viewSalesOperationPlanByPeriod(int period, java.lang.Integer yearInt);

    public boolean breakdownMonthPlannedDemands(java.lang.Integer yearInt, java.lang.Integer monthInt);


    




}
